package com.hhs.storage.controller;


import com.hhs.storage.service.TagService;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author hhs
 * @since 2023-03-30
 */
@RestController
@RequestMapping("/tag")
public class TagController {
    @Resource
    private TagService tagService;

    /**
     * 查询标签
     * @param name
     * @param type
     * @return
     */
    @RequestMapping("/query")
    public Map query(String userId,String name,  String type){
        return tagService.queryList(userId,name,type);
    }
    /**
     * 新增标签
     * @param name
     * @param type
     * @return
     */
    @RequestMapping("/add")
    public Map add(String userId,@RequestParam String name, @RequestParam String type, String color){
        return tagService.add(userId,name,type,color);
    }
    /**
     * 删除标签
     * @param id
     * @return
     */
    @RequestMapping("/delete")
    public Map delete(@RequestParam Integer id){
        return tagService.delete(id);
    }
}

